package com.yanfan.energy.modbus;

import com.serotonin.modbus4j.BatchRead;
import com.serotonin.modbus4j.ModbusMaster;
import com.serotonin.modbus4j.code.DataType;
import com.serotonin.modbus4j.exception.ErrorResponseException;
import com.serotonin.modbus4j.exception.ModbusInitException;
import com.serotonin.modbus4j.exception.ModbusTransportException;
import com.serotonin.modbus4j.locator.BaseLocator;
import com.yanfan.energy.domain.NjEnergyIp;
import com.yanfan.energy.service.INjEnergyDeviceDataService;
import com.yanfan.energy.service.INjEnergyDeviceService;
import com.yanfan.energy.service.INjEnergyIpService;
import com.yanfan.protocol.utils.Modbus4jUtils;
import com.yanfan.protocol.utils.ModbusOffsetUtils;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

//@Component("energyTask")
public class GetModbusTcpData {
    @Resource
    private INjEnergyDeviceService energyDeviceService;
    @Resource
    private INjEnergyIpService energyIpService;
    @Resource
    private INjEnergyDeviceDataService energyDeviceDataService;
    public void  GetModbusTcpData() throws ModbusTransportException, ErrorResponseException, ModbusInitException {
        //获取所有采集器的ip
        List<NjEnergyIp> ips = energyIpService.queryPageList(null);
        for (int i = 0; i < ips.size(); i++) {

        }

    }
}
